const { resolve } = require("path");
const path = require("path");
const WebpackBar = require("webpackbar");
const AutoImport = require("unplugin-auto-import/webpack");
const Components = require("unplugin-vue-components/webpack");
const { ElementPlusResolver } = require("unplugin-vue-components/resolvers");
const dayjs = require("dayjs");
const TerserPlugin = require("terser-webpack-plugin");
const time = dayjs().format("YYYY-M-D HH:mm:ss");
process.env.VUE_APP_UPDATE_TIME = time;
const IS_PROD = ["production", "prod"].includes(process.env.NODE_ENV);

const {
  publicPath,
  assetsDir,
  outputDir,
  lintOnSave,
  transpileDependencies,
  title,
  devPort,
} = require("./custom.config");
module.exports = {
  // publicPath,
  // assetsDir,
  // outputDir,
  // lintOnSave,
  // transpileDependencies,
  devServer: {
    // hot: true,
    port: devPort,
    open: true,
    // noInfo: false,
    // overlay: {
    //   warnings: true,
    //   errors: true,
    // },
  },
  css: {
    loaderOptions: {
      sass: {
        data: `@import "@/assets/scss/common.scss";`,
      },
    },
  },
  configureWebpack: {
    plugins: [
      new WebpackBar({ name: title }),
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    ],
  },
};
